package com.aliwo.algorithm.easy;

/**
 * 演式堆内存溢出.
 *  jps 工具：查看当前系统中有哪些java进程。
 * 	jmap工具：查看堆内存占用情况。 jmap -heap 进程id
 * 	jconsole工具
 * @author Xu Yayuan
 * @date 2022/3/9
 */
public class DemoHeapOOM {
    public static void main(String[] args) throws InterruptedException {
        System.out.println("1....");
        Thread.sleep(40000);
        byte[] array = new byte[1024*1024*10];
        System.out.println("2....");
        Thread.sleep(20000);
        array = null;
        System.gc();
        System.out.println("3....");
        Thread.sleep(3000000L);
    }
}
